﻿Jxstar.currentPage = function() {
	var config = {param:{},initpage:function(page, define){},eventcfg:{}};

	var auditData = Jxstar.findComboData('audit');
	var httypeData = Jxstar.findComboData('httype');

	var cols = [
	{col:{header:'记录状态', width:90, sortable:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: auditData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: auditData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < auditData.length; i++) {
				if (auditData[i][0] == value)
					return auditData[i][1];
			}
		}}, field:{name:'sj_contract_app__auditing',type:'string'}},
	{col:{header:'合同编号', width:100, sortable:true}, field:{name:'sj_contract_app__contract_code',type:'string'}},
	{col:{header:'合同名称', width:220, sortable:true}, field:{name:'sj_contract_app__contract_name',type:'string'}},
	{col:{header:'合同类型', width:100, sortable:true, hidden:true, align:'center',
		editable:false,
		editor:new Ext.form.ComboBox({
			store: new Ext.data.SimpleStore({
				fields:['value','text'],
				data: httypeData
			}),
			emptyText: jx.star.select,
			mode: 'local',
			triggerAction: 'all',
			valueField: 'value',
			displayField: 'text',
			editable:false,
			value: httypeData[0][0]
		}),
		renderer:function(value){
			for (var i = 0; i < httypeData.length; i++) {
				if (httypeData[i][0] == value)
					return httypeData[i][1];
			}
		}}, field:{name:'sj_contract_app__contract_type',type:'string'}},
	{col:{header:'合同金额(万元)', width:100, sortable:true, align:'right',renderer:JxUtil.formatNumber(6)}, field:{name:'sj_contract_app__contract_money',type:'float'}},
	{col:{header:'合同对方单位', width:163, sortable:true}, field:{name:'sj_contract_app__provider_name',type:'string'}},
	{col:{header:'实施单位', width:134, sortable:true}, field:{name:'sj_contract_app__dept_name',type:'string'}},
	{col:{header:'送审部门', width:136, sortable:true}, field:{name:'sj_contract_app__done_deptname',type:'string'}},
	{col:{header:'送审日期', width:100, sortable:true, align:'center',
		renderer:function(value) {
			return value ? value.format('Y-m-d') : '';
		}}, field:{name:'sj_contract_app__app_date',type:'date'}},
	{col:{header:'部门联系人', width:79, sortable:true}, field:{name:'sj_contract_app__dept_user',type:'string'}},
	{col:{header:'部门联系人电话', width:100, sortable:true}, field:{name:'sj_contract_app__dept_phone',type:'string'}},
	{col:{header:'项目负责人', width:77, sortable:true}, field:{name:'sj_contract_app__project_user',type:'string'}},
	{col:{header:'报送资料', width:238, sortable:true, hidden:true}, field:{name:'sj_contract_app__send_data',type:'string'}},
	{col:{header:'项目负责人电话', width:100, sortable:true}, field:{name:'sj_contract_app__project_phone',type:'string'}},
	{col:{header:'主键', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__app_id',type:'string'}},
	{col:{header:'合同ID', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__contract_id',type:'string'}},
	{col:{header:'实施单位id', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__dept_id',type:'string'}},
	{col:{header:'供应商ID', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__provider_id',type:'string'}},
	{col:{header:'项目名称', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__project_name',type:'string'}},
	{col:{header:'项目编号', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__project_code',type:'string'}},
	{col:{header:'立项批复金额(万元)', width:100, sortable:true, hidden:true, align:'right',renderer:JxUtil.formatNumber(6)}, field:{name:'sj_contract_app__project_money',type:'float'}},
	{col:{header:'项目批复文号', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__check_fileno',type:'string'}},
	{col:{header:'合同审计编号', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__sj_code',type:'string'}},
	{col:{header:'送审部门ID', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__done_deptid',type:'string'}},
	{col:{header:'项目ID', width:100, sortable:true, hidden:true}, field:{name:'sj_contract_app__project_id',type:'string'}}
	];
	
	config.param = {
		cols: cols,
		sorts: null,
		hasQuery: '1',
		isedit: '0',
		isshow: '1',
		funid: 'sj_contract_app'
	};
	
	
	config.eventcfg = {			pattach: function() {			var records = this.grid.getSelectionModel().getSelections();			if (!JxUtil.selectone(records)) return;						var self = this;			var keyid = records[0].get('sj_contract_app__project_id');						var params = 'projectid=' + keyid + '&funid=sj_contract_app';			params += '&pagetype=grid&eventcode=pattach';			//发送请求，取相关附件ID			Request.postRequest(params, function(data){JxPm.showAttach(data, 'sj_contract_app', keyid);});		}	};
		
	return new Jxstar.GridNode(config);
}